import Vue from "vue"
import Vuex from "vuex"

Vue.use(Vuex);
export default new Vuex.Store({
    state: {
        account: "",
        userName: "",
        role: ""
    },

    mutations: {
        SAVE(state, items){
            for( let item in items){
                state[item] = items[item];
            }
        },

        REMOVE(state, items){
            for (let item in items){
                state[items[item]] = "";
            }
        },

        REMOVEALL(state){
            for (let item in state){
                state[item] = "";
            }
        }
    },

    actions: {
        SET(context, items) {
            context.commit("SAVE", items);
        }
    },

    getters: {
        GET(state, name) {
            return state[name];
        }
    }
});